<?php
namespace Modules\Topic\Http\Controllers\Client\V1;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

use Modules\Topic\Entities\TopicGroup;

use Validator;
use ThrowException;
use Auth;

class TopicGroupController extends Controller
{
    public function index(Request $req)
    {
        $rule = [
        ];
        Validator::make($req->all(), $rule)->fails() && ThrowException::BadRequest(); 

        $options = $req->all();
        $options['order_by'] = ['list_weight' => 'desc'];
        $options['with_count'] = ['onstock_topics'];

        $list = TopicGroup::getList($options);

        return $list->generateListResponse();
    }

}
